import { ThemeVarService } from '../../lib/abstract/style/theme_var/service'
import { PROJECT_PREFIX } from '../../types/constants'

export function styles(className: string) {
  return `
    .${className} {
      display: flex;
      gap: 8px;
      position: relative;
      z-index: 100;
    }

    .filter-group {
      position: relative;
      
      .dropdown-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }
      
      .group-count {
        font-size: 12px;
        opacity: 0.8;
      }
    }

    .filter-menu-button {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 8px 12px;
      border-radius: 4px;
      background: var(${ThemeVarService.getInstance().default.background.base}) !important;
      color: var(${ThemeVarService.getInstance().default.text.secondary}) !important;
      border: 1px solid var(--${PROJECT_PREFIX}-theme-code-toolbar-divider) !important;
      outline: none !important;
      cursor: pointer;
      transition: all 0.2s ease;
      font-size: 14px;
      
      &:hover {
        background: var(${ThemeVarService.getInstance().link.default.textHover}) !important;
      }
    }
    
    .selected-values-display {
      position: absolute;
      top: 100%;
      left: 50%;
      transform: translateX(-50%);
      display: inline-flex;
      align-items: center;
      background: var(${ThemeVarService.getInstance().tag.blue.bg}) !important;
      border-radius: 12px;
      padding: 2px 8px;
      margin-top: 4px;
      font-size: 12px;
      white-space: nowrap;
    
      .selected-values-text {
        color: var(${ThemeVarService.getInstance().default.text.secondary}) !important;
        margin-right: 4px;
      }
        
      .clear-selection {
        cursor: pointer;
        color: var(${ThemeVarService.getInstance().default.text.neutral}) !important;
        font-size: 16px;
        line-height: 1;
        padding: 2px;
        border-radius: 50%;
        transition: all 0.2s ease;
        
        &:hover {
          background: var(--${PROJECT_PREFIX}-theme-bg-hover) !important;
          color: var(${ThemeVarService.getInstance().message.danger.textPrimary}) !important;
        }
      }
    }

    .filter-group.active .filter-menu-button {
      background: var(${ThemeVarService.getInstance().link.default.textHover}) !important;
      color: white !important;
    }

    .filter-options {
      position: absolute;
      top: 100%;
      left: 0;
      min-width: 180px;
      background: var(${ThemeVarService.getInstance().default.background.base}) !important;
      border: 1px solid var(--${PROJECT_PREFIX}-theme-code-toolbar-divider) !important;
      border-radius: 4px;
      padding: 8px 0;
      opacity: 0;
      visibility: hidden;
      z-index: 110;
      max-height: 400px;
      overflow-y: auto;
    }

    .filter-group.active .filter-options {
      opacity: 1;
      visibility: visible;
      transform: translateY(0);
    }
    
    .filter-select-all {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 4px 8px;
      cursor: pointer;
      
      &:hover {
        background-color: var(--${PROJECT_PREFIX}-theme-toolbar-button-bg-hover) !important;
        .select-all-label {
          color: var(--${PROJECT_PREFIX}-theme-toolbar-button-text) !important;
        }
      }
      
      .select-all-checkbox {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 16px;
        height: 16px;
        border: 1px solid var(${ThemeVarService.getInstance().default.border.colorNeutral}) !important;
        border-radius: 3px;
        margin-right: 8px;
        
        &.checked {
          background: #1976d2;
          color: white;
          border-color: transparent;
        }
      }
    
      .select-all-label {
        font-size: 0.9rem !important;
        color: var(${ThemeVarService.getInstance().default.text.secondary}) !important;
      }
    }

    .filter-option {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 4px 8px;
      color: var(${ThemeVarService.getInstance().default.text.secondary}) !important;
      cursor: pointer;
      user-select: none;
      margin-bottom: 5px;
      
      &:hover {
        background-color: var(--${PROJECT_PREFIX}-theme-toolbar-button-bg-hover) !important;
        .option-label {
          color: var(--${PROJECT_PREFIX}-theme-toolbar-button-text) !important;
        }
      }
      &.selected {
        .option-label {
          color: #1976d2 !important;
        }
      }
      
      .filter-checkbox {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 16px;
        height: 16px;
        border: 1px solid var(${ThemeVarService.getInstance().default.border.colorNeutral}) !important;
        border-radius: 3px;
        margin-right: 8px;
        
        &.checked {
          background: #1976d2;
          color: white;
          border-color: transparent;
        }
      }
      
      .option-icon {
        margin-top: -4px;
      }
      
      .option-label {
        font-size: 0.9rem !important;
        color: var(${ThemeVarService.getInstance().default.text.secondary}) !important;
      }
      
      .option-count {
        margin-left: auto;
        font-size: 12px;
        opacity: 0.8;
      }
    }

    .filter-option.single-mode .filter-checkbox {
      display: none;
    }
  `
}
